Skip to content

Meet: disconnect on background, reconnect on resume#280

Draft
MaxHeimbrock wants to merge 1 commit into
mainfrom
max/meet-disconnect-on-background
Draft

Meet: disconnect on background, reconnect on resume#280
MaxHeimbrock wants to merge 1 commit into
mainfrom
max/meet-disconnect-on-background

Conversation

@MaxHeimbrock
Copy link
Copy Markdown
Contributor

@MaxHeimbrock MaxHeimbrock commented May 13, 2026

Summary

Alternative to #281
Attempt to not have to run FOREGROUND_SERVICE

  • On OnApplicationPause(true) the Meet sample now disconnects from the room and cleans up tracks (after snapshotting whether camera/mic were active).
  • On OnApplicationPause(false) it rebuilds the connection by re-fetching a token, reconnecting, and re-publishing camera/mic if they were on before.
  • Without this, locking the screen on iOS (or long backgrounding on Android) causes the Rust SDK's reconnect loop (10 × 5s) to burn through retries while the process is suspended, fire Disconnected, and never recover.

This is a sample-level fix only — the underlying SDK still has no manual reconnect surface; that's a separate item.

I don't like this solution...

On iOS, the OS suspends the process within seconds of the screen locking or the
app being backgrounded. While suspended, the Rust SDK's reconnect loop (10
attempts × 5s) cannot actually run, exhausts its retries, and fires Disconnected
with no path to recover when the app returns to the foreground. Android shows
the same symptom under longer backgrounding via Doze.

Disconnect the room cleanly when OnApplicationPause(true) fires, and rebuild the
connection — auto-restoring camera and mic if they were enabled — when the app
resumes. This avoids relying on the engine's auto-reconnect across a suspension
window where it can't make progress.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MaxHeimbrock MaxHeimbrock force-pushed the max/meet-disconnect-on-background branch from 9dfbe2f to e57ed15 Compare May 13, 2026 10:01
@MaxHeimbrock MaxHeimbrock marked this pull request as draft May 18, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant